<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Team Bonus Summary</title>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>
<script language="javascript"> 
function transfer(date_begin,date_end){
	window.location.href = 'http://<?php echo WEB_IP?>/repairparts/repair-wizard-confirm/date_begin/'+ date_begin + '/date_end/' + date_end + '/next/yes';
}

function tickAll(source){
	if(source.checked){
		$('.checkbox').prop('checked',true);
	}else{
		$('.checkbox').prop('checked',false);
	}
}

</script>

</head>
<body style="font-family:Arial, Helvetica, sans-serif; line-height:20px;">
<form method = "post" action = "">
<h2>Calculate Repair Bonus for cycle ( <?php echo $this->cycle;?> )</h2>
<h3><?php echo $this->dateBegin;?> ~ <?php echo $this->dateEnd;?></h3>
<?php $stDetail = new Model_DbTable_Roster_Stafflogindetail(Zend_Registry::get('db_remoteapp'));
	  $stInfo = new Model_DbTable_Roster_Staffinfo(Zend_Registry::get('db_remoteapp'));
	?>
Tick All<input type = "checkbox" id = "tick_all" onclick = "tickAll(this)"></input>
<table border="1" cellspacing="1" cellpadding="5">
	<tr>
		<th>Shop Group</th>
		<th>Total Bonus</th>
		<th>Staff Bonus</th>
	</tr>
	<?php foreach ($this->list as $k => $v){?>
	<tr>
		<td><?php echo $k?></td>
		<td><input type = "text" name = "netBonus[<?php echo $k?>]" value = "<?php echo $v['repair_bonus']?>"></input></td>
		<td>
		<table width = "100%">
		<?php if(!empty($v['listone']) && is_numeric($v['listone'])){ ?>
						<tr>
							<td>
					<?php 	$stName = $stInfo->getStaffinfo($v['listone']);
							$stLine = $stDetail->getDetail($v['listone']);
					 		echo '1.'.$stName['first_name']." ".$stName['last_name']." ( ".$stLine['ni']." ) ";?>
							</td>
							<td align = "right">
							<?php if($stLine['a'] == 9){echo "<img src=\"/im/gone.jpg\" />";} ?><input type = "checkbox" name = "checkbox1[<?php echo $k?>][<?php echo $v['listone']?>]" value = "<?php echo $v['listone']?>" class = "checkbox"></input><input type = "hidden" name = "allList1[<?php echo $k?>][<?php echo $v['listone']?>]" value = "<?php echo $v['listone']?>" ></input>
							</td>
						</tr>
			<?php 	}else{ ?>
						<tr>
							<td>
						<?php echo "No 1st Staff";
					}?>
						</td>
					</tr>
			<?php 
					if(!empty($v['listtwo']) && is_numeric($v['listtwo'])){ ?>
						<tr>
							<td>
					  <?php $stName = $stInfo->getStaffinfo($v['listtwo']);
							$stLine = $stDetail->getDetail($v['listtwo']);
						 	echo '2.'.$stName['first_name']." ".$stName['last_name']." ( ".$stLine['ni']." ) ";?>
							</td>			
							<td align = "right"><?php if($stLine['a'] == 9){echo "<img src=\"/im/gone.jpg\" />";} ?><input type = "checkbox" name = "checkbox2[<?php echo $k?>][<?php echo $v['listtwo']?>]" value = "<?php echo $v['listtwo']?>" class = "checkbox"></input><input type = "hidden" name = "allList2[<?php echo $k?>][<?php echo $v['listtwo']?>]" value = "<?php echo $v['listtwo']?>" ></input></td>			
						</tr>
					<?php }else{ ?>
						<tr>
							<td>
						<?php  echo "No 2nd Staff ";?>
							</td>						
						</tr>
				  <?php } ?>
			<?php if(!empty($v['listrest'])){
							foreach($v['listrest'] as $k3 => $v3){ ?>
							<?php if($v3 && is_numeric($v3)){?>
							<tr>
								<td>
							<?php 
								$stName = $stInfo->getStaffinfo($v3);
								$stLine = $stDetail->getDetail($v3);
						 		echo 'Rest.'.$stName['first_name']." ".$stName['last_name']." ( ".$stLine['ni']." ) ";?>
								</td>
								<td align = "right"><?php if($stLine['a'] == 9){echo "<img src=\"/im/gone.jpg\" />";} ?><input type = "checkbox" name = "checkboxRest[<?php echo $k?>][<?php echo $v3?>]" value = "<?php echo $v3?>" class = "checkbox"></input><input type = "hidden" name = "allListRest[<?php echo $k?>][<?php echo $v3?>]" value = "<?php echo $v3?>" ></input></td>
							</tr>
							<?php }?>
					<?php }
						}else{ ?>
							<tr>
								<td>
						<?php echo "No Rest Staff ";?>
								</td>
							</tr>
				  <?php } ?>	
			</table>
		</td>
	</tr>
	
	<?php }?>
</table>
<br/>
<input type = "submit" name ="submit" id = "submit" value = "Confirm" onclick="if(confirm('Continue calculate repair bonus?')){} else {return false;};"></input>
</form>
<div id = "payrollWizard" <?php if(!$this->nextCheck){?>style = "visibility:hidden;<?php }?>">
<input type = "submit" name = "next" id = "next" value = "Next" style = "margin-left:680px;" onclick= "transfer('<?php echo $this->dateBegin;?>','<?php echo $this->dateEnd;?>')"></input>
</div>
</body>
</html>